<?php

declare(strict_types=1);

namespace app\model\admin;

use app\model\AdminBaseModel;
use think\Model;

/**
 * @mixin \think\Model
 * 规格模版
 */
class ProductAttrTemp extends AdminBaseModel
{
    // 数据表名称
    protected $table = 'product_attr_temp';
    protected $scopeField = true;

    //可搜索字段
    protected $searchField = [];
    // like
    protected $singleSearchField = ['rule_name'];
    //可作为条件的字段
    protected $whereField = ['status'];
    //可做为时间范围查询的字段
    protected $timeField = ['created_at'];

    public function getRuleValueAttr($val, $data)
    {
        if (isset($data['rule_value'])) {
            // var_dump($data['rule_value']);
            return json_decode($data['rule_value'], true);
        }
    }
}
